package xyz.yzy.coc.myqqrobot.dao;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionFactorctry {
	private static String className="com.mysql.jdbc.Driver";
	private static String url="jdbc:mysql://localhost:3306/cocto?useSSL=true";
	private static String user="root";
	private static String pwd="root";
	
	public static Connection getConnection(){
		Connection connection=null;
		try {
			
			Class.forName(className);
			connection = DriverManager.getConnection(url,user,pwd);
		} catch (Exception e) {
			System.out.println("第一次");
			e.printStackTrace();
		} 
		return connection;
	}

	public static void setClassName(String className) {
		ConnectionFactorctry.className = className;
	}

	public static void setUrl(String url) {
		ConnectionFactorctry.url = url;
	}

	public static void setUser(String user) {
		ConnectionFactorctry.user = user;
	}

	public static void setPwd(String pwd) {
		ConnectionFactorctry.pwd = pwd;
	}
}
